package org.igeek.atomqq.activity;


import org.igeek.atomqq.R;

import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.view.Window;
import android.widget.TextView;

public class BaseActivity extends  Activity {
	public static final int DIALOG_ERROR=0x404;
	public static final String FLAG_ERROR="404";
	
	
	private Dialog dialog;
	
	@Override
	protected Dialog onCreateDialog(int id, Bundle args) {
		dismissAllDialog();
		
		if(id==DIALOG_ERROR){
			if(null==dialog){
				dialog= new Dialog(this,android.R.style.Theme_Translucent_NoTitleBar);
				dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
				dialog.setContentView(R.layout.dialog_message);
			}
			String message=args.getString(FLAG_ERROR);
			((TextView)dialog.findViewById(R.id.dialog_message_tvMessage)).setText(message);
			return dialog;
		}
		return super.onCreateDialog(id, args);
	}
	
	protected void dismissAllDialog(){
		if(null!=dialog&&dialog.isShowing())
			dialog.dismiss();
		
		
	}
	
	
	
	
}
